import sys
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QHBoxLayout, QPushButton, QToolTip
from PyQt5.QtGui import QFont

class TooltipForm(QMainWindow):

    def __init__(self):
        super(TooltipForm, self).__init__()
        self.initUI()

    def initUI(self):
        QToolTip.setFont(QFont('SansSerif', 12))
        self.setToolTip('今天是星期五')
        self.setGeometry(300, 30, 200, 300)
        self.setWindowTitle("控件提示信息")

        self.btn1 = QPushButton('按钮')
        self.btn1.setToolTip('这是一个按钮')

        layout = QHBoxLayout()
        layout.addWidget(self.btn1)

        mainFrame = QWidget()
        mainFrame.setLayout(layout)
        self.setCentralWidget(mainFrame)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    main = TooltipForm()
    main.show()
    sys.exit(app.exec_())


